<?php
/**
 * CreateTime: 2023/2/16 11:23
 */

namespace App\Models\MeLawCase;

use App\Consts\TableConsts\TableConsts;
use App\Func\StaffFunc;
use App\Models\BaseModelV2;

class MeLawCaseFollowModel  extends BaseModelV2
{
    protected $table = TableConsts::ME_LAW_CASE_FOLLOW;

    protected $primaryKey = 'law_case_wh_follow_id';

    public function getByLawCaseId($lawCaseId,$select=["*"])
    {
        return $this->select($select)->where('law_case_id',$lawCaseId)->orderBy('law_case_wh_follow_id','desc')->get();
    }

    public function getNexExtStatusByLawCaseId($lawCaseId)
    {
        return $this->where('law_case_id',$lawCaseId)->orderBy('law_case_wh_follow_id','desc')->first();
    }

    public function getOwnerStrAttribute($value){
        $staffAll = StaffFunc::getStaffAllBySelect();
        return StaffFunc::getStaffNameByStaffId($staffAll,$value);
    }

}